local example = {}
example.title = "公寓1"

function example.func()
	
	local frame = loveframes.Create("frame")
	frame:SetName("公寓1")
	frame:CenterWithinArea(unpack(demo.centerarea))
	frame:SetIcon("resources/images/application.png")
	frame:SetDockable(true)
	frame:SetScreenLocked(true)
	frame:SetResizable(true)
	frame:SetWidth(100)
	frame:SetHeight(600)
	frame:SetMaxWidth(800)
	frame:SetMaxHeight(1000)
	frame:SetMinWidth(400)
	frame:SetMinHeight(500)
  
  local image = loveframes.Create("image", frame)
	image:SetImage("resources/images/carlsagan.png")
	image:SetPos(5, 30)
		
	local button = loveframes.Create("button", frame)
	button:SetText("设置模式窗口")
	button:SetWidth(100)
	button:Center()
	button.Update = function(object, dt)
		object:Center()
		local modal = object:GetParent():GetModal()
		if modal then
			object:SetText("取消模式窗口")
			object.OnClick = function()
				object:GetParent():SetModal(false)
			end
		else
			object:SetText("设置模式窗口")
			object.OnClick = function()
				object:GetParent():SetModal(true)
			end
		end
	end
	
end

demo.RegisterExample(example)